﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using SB.Logging;
using SB.UserSettings;

namespace SB.CustomControlLibrary
{
    public partial class TicketLineDatagridRename : Form
    {
        UserSetting s;
        string before;
        
        public TicketLineDatagridRename(UserSetting setting)
        {
            InitializeComponent();

            s = setting;
            before = setting.Text;

            Text = "Beschriftung für Property " + s.Name + " ändern";
            lblAlteBeschriftung.Text = "Alte Beschriftung: " + before;
            txtNeueBeschriftung.DataBindings.Add(new Binding("Text", s, "Text"));
            txtNeueBeschriftung.SelectAll();

            AcceptButton = btnOK;
            CancelButton = btnCancel;
        }

        private void txtNeueBeschriftung_TextChanged(object sender, EventArgs e)
        {
            btnOK.Enabled = txtNeueBeschriftung.Text.Length > 0;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            s.Text = before;
        }
    }
}
